#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys

reload(sys)
sys.setdefaultencoding('utf-8')

for i in sys.stdin:
    t=i.strip().split('\t')
    if len(t)==4:
        cis,sid,day,urls=t
        eps=urls.strip().split(',')
        if len(set(eps[:3]))==3:
            print '\t'.join(map(str,t[:2]+eps[:3]+[day]))